if select(2, UnitClass('player')) ~= "SHAMAN" then
	return
end
Yata = LibStub("AceAddon-3.0"):NewAddon("Yata", "AceConsole-3.0", "AceEvent-3.0", "LibBars-1.0")
local L = LibStub("AceLocale-3.0"):GetLocale("Yata")
local LibKeyBound = LibStub("LibKeyBound-1.0")
local defaults = {
	profile = {
		BarScale = 1.0,
		BarOrientation = 1,		
		ButtonGap = 0,
		VisibleButtons = 1,
		AutoButtonSwap = true,
		Locked = true,
		ShowTooltip = true,
		ShortTooltip = true,
		TimerEnabled = true,
		TimerType = 1,
		TimerScale = 1.0,
		ButtonSkin = "Blizzard",
		TimerBarSkin = "Blizzard",
		MacroResetKey = "shift",
		ButtonSwapKey = "none",
		ButtonNoSwapKey = "none",
		CurrentTotemSet = "default",
	},
};

function Yata:OnInitialize()
    -- Called when the addon is loaded
	self.db = LibStub("AceDB-3.0"):New("YataDB", defaults)
	LibStub("AceConfig-3.0"):RegisterOptionsTable("Yata", self:PopulateOptions(), {"yatacmd"})
	self:RegisterChatCommand("yata", function() LibStub("AceConfigDialog-3.0"):Open("Yata") end)	
	LibKeyBound.RegisterCallback(self, "LIBKEYBOUND_ENABLED")
	LibKeyBound.RegisterCallback(self, "LIBKEYBOUND_DISABLED")
	LibKeyBound.RegisterCallback(self, "LIBKEYBOUND_MODE_COLOR_CHANGED")
	self:RegisterEvent("LEARNED_SPELL_IN_TAB", "Reload");
end

function Yata:OnEnable()
	self:InitTotems()
	self:InitTotemSets()
	self:CreateTotemBar()					
	self:LoadBarConfig()
	self:InitTimer()
	self:EditMacro(true,nil,nil)
	self.TotemBarGrip:Show()
end

function Yata:OnDisable()
    self.TotemBarGrip:Hide()
end

function Yata:Reload()
	DEFAULT_CHAT_FRAME:AddMessage("Reloading...")
	self:OnDisable()
	self:OnEnable()
end